package com.ejlchina.tool.util

import android.widget.Toast
import com.huyuhui.fastble.data.BleDevice
import com.ejlchina.tool.MyApplication
import com.ejlchina.tool.bean.BleDeviceBean
import java.io.ByteArrayOutputStream
import java.io.DataOutputStream
import java.nio.ByteBuffer
import java.nio.ByteOrder

fun showToast(showString: String? = null, resId: Int? = null, duration: Int = Toast.LENGTH_SHORT) {
    val context = MyApplication.instance.applicationContext
    showString?.let {
        Toast.makeText(context, it, duration).show()
    }
    resId?.let {
        Toast.makeText(context, context.getString(it), duration).show()
    }
}

fun removeSpecifiedDeviceInList(list: MutableList<BleDeviceBean>,bleDevice: BleDevice){
    for (item in list){
        if (item.bleDevice.mac == bleDevice.mac){
            list.remove(item)
            break
        }
    }
}